home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CU Amiga Super CD-ROM 21
/
CU Amiga Magazine's Super CD-ROM 21 (1998)(EMAP Images)(GB)[!][issue 1998-04].iso
/
CUCD
/
Programming
/
Python-1.4
/
Lib
/
test
/
test_strop.py
< prev
next >
Wrap
Text File
|
1996-12-16
|
481b
|
22 lines
import strop, sys
def test(name, input, output):
f = getattr(strop, name)
try:
value = f(input)
except:
value = sys.exc_type
if value != output:
print f, `input`, `output`, `value`
test('atoi', " 1 ", 1)
test('atoi', " 1x", ValueError)
test('atoi', " x1 ", ValueError)
test('atol', " 1 ", 1L)
test('atol', " 1x ", ValueError)
test('atol', " x1 ", ValueError)
test('atof', " 1 ", 1.0)
test('atof', " 1x ", ValueError)
test('atof', " x1 ", ValueError)